package com.wac.data.mapper;

import com.wac.data.entity.Like;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author beta
 * @since 2023-03-16
 */
public interface LikeMapper extends BaseMapper<Like> {

	//获取某用户的获赞数量
	@Select("select count(*) from `like` where belong_id = #{userId}")
	int getLikeNum(String userId);

	//获取某个实体的获赞数量
	@Select("select count(*) from `like` where entity_id = #{id}")
	int getEntityLikeNum(String id);

}
